package cn.xiaoa.teicode.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;

@Configuration
@EnableWebSecurity
public class SecurityConfig {
    @Bean
    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
        http
                // 所有请求永久放行
                .authorizeHttpRequests(authorize -> authorize
                        .anyRequest().permitAll()
                )
                // 前后端分离先关掉 CSRF，后续再开
                .csrf(csrf -> csrf.disable());
        return http.build();
    }
}